package com.mathassistant.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Image;
import com.mathassistant.client.presenter.ComponentAnwserPresenter;
import com.mathassistant.client.presenter.ExerciseStepEditPresenter.Display;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Anchor;

public class ExerciseStepEditView extends Composite implements Display{

	private static ExerciseStepEditViewUiBinder uiBinder = GWT
			.create(ExerciseStepEditViewUiBinder.class);
	@UiField VerticalPanel listComponent;
	@UiField Button saveButton;
	@UiField Button closeButton;
	@UiField Image addImage;
	@UiField Image subtractImage;
	@UiField Anchor addAnchor;
	@UiField Anchor subtractAnchor;

	interface ExerciseStepEditViewUiBinder extends
			UiBinder<Widget, ExerciseStepEditView> {
	}

	public ExerciseStepEditView() {
		initWidget(uiBinder.createAndBindUi(this));
		saveButton.addStyleName("exstep-button");
		closeButton.addStyleName("exstep-button");
	}

	@Override
	public HasClickHandlers getAddButton() {
		// TODO Auto-generated method stub
		return addAnchor;
	}

	@Override
	public HasClickHandlers getSubtractButton() {
		// TODO Auto-generated method stub
		return subtractAnchor;
	}

	@Override
	public HasClickHandlers getAddImage() {
		// TODO Auto-generated method stub
		return addImage;
	}
	
	@Override
	public HasClickHandlers getSubtractImage() {
		// TODO Auto-generated method stub
		return subtractImage;
	}
	
	@Override
	public HasClickHandlers getSaveButton() {
		// TODO Auto-generated method stub
		return saveButton;
	}

	@Override
	public HasClickHandlers getCloseButton() {
		// TODO Auto-generated method stub
		return closeButton;
	}

	@Override
	public void setAddComponent(ComponentAnwserPresenter component) {
		// TODO Auto-generated method stub
		listComponent.add(component.getDisplay().asWidget());
	}

	@Override
	public void setSubtractComponent(ComponentAnwserPresenter component) {
		// TODO Auto-generated method stub
		listComponent.remove(component.getDisplay().asWidget());
	}

	@Override
	public Widget asWidget() {
		// TODO Auto-generated method stub
		return this;
	}
}
